package studio.raptor.databus.graph.exception;

import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 图服务异常处理
 *
 * @author jack
 * @since 1.0
 */
@RestControllerAdvice
public class GraphServiceExceptionHandler {


  @ExceptionHandler(value = {IllegalArgumentException.class})
  @ResponseStatus(HttpStatus.BAD_REQUEST)
  public String handleIllegalArgumentException(IllegalArgumentException e) {
    return e.getMessage();
  }



  @ExceptionHandler(value = {GraphServiceException.class})
  @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
  public String handleGraphServiceException(GraphServiceException e) {
    return e.getMessage();
  }


}
